package com.wsd.jing.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wsd.jing.annotation.Status;
import com.wsd.jing.validator.group.InsertGroup;
import com.wsd.jing.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * All rights Reserved, Designed By www.tom.com
 *
 * @author tom
 * @version 1.0.0
 * @projectName: jing
 * @packageName: com.wsd.jing.entity
 * @className: DictionaryDetail
 * @description: 数据字典详情
 * @createDate 2022-11-14 07:02
 * @copyright 2022-11-14 07:02 www.tom.com Inc. All rights reserved.
 */
@Getter
@Setter
@ToString
@TableName("j_dictionary_detail")
@ApiModel(value = "DictionaryDetail对象", description = "数据字典详情表")
public class DictionaryDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "数据字典详情ID不能为空", groups = UpdateGroup.class)
    @Null(message = "数据字典详情ID为空", groups = InsertGroup.class)
    @ApiModelProperty("数据字典详情ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotNull(message = "数据字典ID不能为空")
    @ApiModelProperty("数据字典ID")
    @TableField("dictionary_id")
    private Integer dictionaryId;

    @NotNull(message = "状态不能为空")
    @Status(booleanValues = {false, true}, message = "状态格式不正确")
    @ApiModelProperty("状态=>0:停用，1:启用")
    @TableField("status")
    private Boolean status;

    @NotNull(message = "序号不能为空")
    @ApiModelProperty("序号")
    @TableField("sort")
    private Integer sort;

    @NotBlank(message = "名称不能为空")
    @Length(max = 50, message = "名称不能超过50个字符")
    @ApiModelProperty("名称")
    @TableField("name")
    private String name;

    @NotBlank(message = "值不能为空")
    @Length(max = 50, message = "值不能超过50个字符")
    @ApiModelProperty("值")
    @TableField("content")
    private String content;

    @Length(max = 100, message = "描述不能超过100个字符")
    @ApiModelProperty("描述")
    @TableField("description")
    private String description;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("修改时间")
    @TableField("update_time")
    private LocalDateTime updateTime;


}
